package inesv.proto;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class GenerareClass {
    public static void main(String[] args) throws IOException {
        String protoPath = System.getProperty("user.dir") + "\\src\\main\\resources\\proto";
        List<String> protoFileList = new ArrayList<String>();
        File f = new File(protoPath);
        File fa[] = f.listFiles();
        for (int i = 0; i < fa.length; i++) {
            File fs = fa[i];
            if (fs.isFile()) {
                protoFileList.add(fs.getName());
            }
        }
        for (String protoFile : protoFileList) {
            System.out.println(protoFile);
            
            String strCmd = "D:/file/blockChain/protobuf-java-3.5.1/protobuf-3.5.1/src/protoc.exe --java_out=../../java " + protoFile;
            Runtime.getRuntime().exec(strCmd, null, new File(protoPath));
        }
    }
}
